﻿<%@ Page Title="" Language="C#" MasterPageFile="~/resumemanager/resume.master" Inherits="WebManager.BasePage" %>

<%@ Import Namespace="TalentPools.BLL" %>
<%@ Import Namespace="TalentPools.Model" %>
<script runat="server">

    public int num
    {
        get { return Convert.ToInt32(ViewState["num"]); }
        set { ViewState["num"] = value; }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!MyUserLogin())
        {
            Response.Redirect("~/Index.aspx");
        }
        if (!IsPostBack)
        {
            ddlhy.DataSource = new baseConfigManager().getconfigInfo("行业");
            ddlhy.DataTextField = "value";
            ddlhy.DataValueField = "value";
            ddlhy.DataBind();

            ddlmoney.DataSource = new baseConfigManager().getconfigInfo("薪资");
            ddlmoney.DataTextField = "value";
            ddlmoney.DataValueField = "value";
            ddlmoney.DataBind();

            ddlworkplace.DataSource = new baseConfigManager().getconfigInfo("地点");
            ddlworkplace.DataTextField = "value";
            ddlworkplace.DataValueField = "value";
            ddlworkplace.DataBind();

            ddlzhiwei.DataSource = new baseConfigManager().getconfigInfo("职位");
            ddlzhiwei.DataTextField = "value";
            ddlzhiwei.DataValueField = "value";
            ddlzhiwei.DataBind();

            rblcurrentstate.DataSource = new baseConfigManager().getconfigInfo("目前状态");
            rblcurrentstate.DataTextField = "value";
            rblcurrentstate.DataValueField = "value";
            rblcurrentstate.DataBind();

            List<intention> list = new alertResumeManager().getintentionByid(Convert.ToInt32(Session["resumeId"]));
            num = list.Count;
            if (list.Count == 1)
            {
                intention inten = list[0];
                rbwtype.SelectedValue = inten.jobCategory;
                ddlworkplace.SelectedValue = inten.area;
                ddlhy.SelectedValue = inten.industry;
                ddlzhiwei.SelectedValue = inten.profession;
                rblcurrentstate.SelectedValue = inten.state;
            }
        }
    }
    protected void btnsubmit_Intention_Click(object sender, EventArgs e)
    {
        intention inte = new intention();
        inte.jobCategory = rbwtype.SelectedValue;
        inte.pay = ddlmoney.SelectedValue;
        inte.resumeId = Convert.ToInt32(Session["resumeId"]);
        inte.state = rblcurrentstate.SelectedValue;
        inte.industry = ddlhy.SelectedValue;
        inte.profession = ddlzhiwei.SelectedValue;
        inte.area = ddlworkplace.SelectedValue;
        bool result = false;
        if (num >= 1)
        {
            if (new alertResumeManager().updatinteByid(inte))
            {
                lblintention.Text = "更新成功！";
                result = true;
            }
        }
        else if (num == 0)
        {
            if (new CreateresumeManager().createIntention(inte))
                result = true;
        }
        if (result == false)
        {
            lblintention.Text = "求职意向添加失败，如果确认信息填写无误，请联系管理员解决问题！";
        }
    }
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    `
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:Panel ID="plintention" runat="server" Visible="true">
        <table width='100%' border='0' align='center' cellpadding='4' cellspacing='1' class='border'>
            <tr class='tdbg'>
                <td colspan="2" class="topbg2">
                    <div align="center" class="Glow">
                        <strong>求 职 意 向</strong></div>
                </td>
            </tr>
            <tr class='tdbg'>
                <td class="tdbg1">
                    <div align="right">
                        工作类型：</div>
                </td>
                <td class="tdbg2" style="width: 482px">
                    <asp:RadioButtonList ID="rbwtype" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
                        <asp:ListItem Selected="True" Value="不限">不限</asp:ListItem>
                        <asp:ListItem Value="全职">全职</asp:ListItem>
                        <asp:ListItem Value="兼职">兼职</asp:ListItem>
                        <asp:ListItem Value="实习">实习</asp:ListItem>
                    </asp:RadioButtonList>
                </td>
            </tr>
            <tr class='tdbg'>
                <td class="tdbg1">
                    <div align="right">
                        工作地点：</div>
                </td>
                <td class="tdbg2" style="width: 482px">
                    <asp:DropDownList ID="ddlworkplace" runat="server" Width="">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr class='tdbg'>
                <td class="tdbg1">
                    <div align="right">
                        职位：</div>
                </td>
                <td class="tdbg2" style="width: 482px">
                    <asp:DropDownList ID="ddlzhiwei" runat="server" Width="">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr class='tdbg'>
                <td class="tdbg1">
                    <div align="right">
                        行业：</div>
                </td>
                <td class="tdbg2" style="width: 482px">
                    <asp:DropDownList ID="ddlhy" runat="server" Width="">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr class='tdbg'>
                <td class="tdbg1">
                    <div align="right">
                        <div align="right">
                            薪资要求：</div>
                    </div>
                </td>
                <td class="tdbg2" style="width: 482px">
                    <asp:DropDownList ID="ddlmoney" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr class='tdbg'>
                <td class="tdbg1">
                    <div align="right">
                        目前状态：</div>
                </td>
                <td class="tdbg2" style="width: 482px">
                    <asp:RadioButtonList ID="rblcurrentstate" Width="482px" runat="server" RepeatDirection="Vertical">
                    </asp:RadioButtonList>
                </td>
            </tr>
        </table>
        <br />
        <table width="100%" border="0">
            <tr>
                <td>
                    <div align="center">
                        &nbsp;<asp:Button ID="btnsubmit_Intention" runat="server" Text="提 交" OnClick="btnsubmit_Intention_Click" />&nbsp;
                        <label>
                            <input type="reset" name="Submit2" value="重 置" /><br />
                            <asp:Label ID="lblintention" runat="server" ForeColor="Red"></asp:Label></label></div>
                </td>
            </tr>
        </table>
    </asp:Panel>
</asp:Content>
